package ch06.home;

class Exercise6_22 {
	//<1
	public static boolean isNumber(String str) {
		if (str == null || str.equals(""))	return false;
		for (int i = 0; i < str.length(); i++) {
			char ch = str.charAt(i);
			if (ch < '0' || ch > '9') return false;
		}
		return true;
	}
	//1>

	public static void main(String[] args) {
		String str = "123";
		System.out.println(str + " number? " + isNumber(str));

		str = "1234o";
		System.out.println(str + " number? " + isNumber(str));
	}
}
/*
123 number? true
1234o number? false
*/
